/**
 * 用户笔记管理
 * @project readnote
 * @author huxh
 * @date 2012-5-15
 **/
package com.readnote.admin.sys;

import com.cr.backbone.action.AppBaseActionSupport;
import com.cr.backbone.model.SysFile;
import com.cr.backbone.service.business.sysfile.SysFileService;

public class SysFileManageAction extends AppBaseActionSupport{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1179031234511250745L;
	
	private Long[] ids;//数据更新主键集合
	private SysFile sysFile;

	
	private SysFileService sysFileService;
	
	/***
	 * 查看 sysFile list
	 */
	public String index(){
		page = sysFileService.getPage(getQuery(), page);
		return INDEX;
	}
	
	/***
	 * 查看 sysFile list
	 */
	public String query(){
		page = sysFileService.getPage(getQuery(), page);
		return INDEX;
	}
	
	/**
	 * 进入sysFile更新页面
	 */
	public String input(){
		if(ids!=null && ids.length!=0)
			sysFile = sysFileService.get(ids[0]);
		return INPUT;
	}
	
	/**
	 * 保存（新建\更新）
	 * @methodDescribe 
	 * @return
	 * @author xianghua.hu
	 * @date 2012-5-15
	 */
	public String save(){
		if(sysFile==null || sysFile.isNullRow()){
			sysFileService.save(sysFile);
		}else{
			SysFile _sysFile = sysFileService.get( sysFile.getId() );
			
			sysFileService.update(_sysFile);
		}
		return SUCCESS;
	}
	
	public String delete() {
		for(Long id : ids)
			sysFileService.deleteById(id);
		return query();
	}

	public Long[] getIds() {
		return ids;
	}

	public void setIds(Long[] ids) {
		this.ids = ids;
	}

	public SysFile getSysFile() {
		return sysFile;
	}

	public void setSysFile(SysFile sysFile) {
		this.sysFile = sysFile;
	}

	public SysFileService getSysFileService() {
		return sysFileService;
	}

	public void setSysFileService(SysFileService sysFileService) {
		this.sysFileService = sysFileService;
	}
	
	

	
}
